// Author: wsfuyibing <682805@qq.com>
// Date: 2025-06-12

package kind

// TicketState
// 渔票状态.
type TicketState int

const (
	TicketStateEnabled  TicketState = 1
	TicketStateDisabled TicketState = 2
)

var (
	ticketStateTexts = map[TicketState]string{
		TicketStateEnabled:  "启用",
		TicketStateDisabled: "停用",
	}
	ticketStateUndefined = ""

	ticketStateFlags = map[TicketState]string{
		TicketStateEnabled:  "enabled",
		TicketStateDisabled: "disabled",
	}
	ticketStateUnknownFlag = ""
)

func TicketStateDict() []map[string]any {
	var res = make([]map[string]any, 0)
	for _, v := range []TicketState{
		TicketStateEnabled,
		TicketStateDisabled,
	} {
		res = append(res, map[string]any{
			"Key":   v,
			"Value": v.Text(),
		})
	}
	return res
}

func (o TicketState) Flag() string {
	if str, ok := ticketStateFlags[o]; ok {
		return str
	}
	return ticketStateUnknownFlag
}

func (o TicketState) IsEnabled() bool  { return o == TicketStateEnabled }
func (o TicketState) IsDisabled() bool { return o == TicketStateDisabled }

func (o TicketState) Text() string {
	if str, ok := ticketStateTexts[o]; ok {
		return str
	}
	return ticketStateUndefined
}
